package touro.mancala.client.view;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JComponent;

import touro.mancala.client.Stone;

public class StoneView extends JComponent {

	private static final long serialVersionUID = -3430510032512529251L;
	private Stone stone;
	
	public StoneView(Stone s) {
		this.setStone(s);
	}

	public void paintComponent(Graphics g, int x, int y, int width, int height) {
		super.paintComponent(g);
		Color color = stone.getColor();
		//sets g to transparent black for drawing the shadow
		g.setColor(new Color(0, 0, 0, 50));
		g.fillOval(x, y-width/3, width+(height/5), height+(width/3));
		g.setColor(color);
		g.fillOval(x, y, width, height);
		//sets g to transparent white for drawing the highlight
		g.setColor(new Color(255, 255, 255, 20));
		g.fillOval(x+width/5, y+width/5, 3*width/5, 3*width/5);
		g.setColor(Color.BLACK);
		g.drawOval(x, y, width, height);
	}

	public void setStone(Stone stone) {
		this.stone = stone;
	}

	public Stone getStone() {
		return stone;
	}
	

}
